package com.bosssoft.trainee.config;

import com.bosssoft.trainee.security.config.SecurityConfig;
import com.bosssoft.trainee.service.UserService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.core.userdetails.UserDetailsService;

/**
 * @Author: wuxin
 * @Project: rbac
 * @Date: 2022/6/23
 * @Description:
 */
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class RbacSecurityConfig extends SecurityConfig {
    @Bean
    public UserDetailsService userDetailsService(UserService userService) {
        //获取登录用户信息
        return userService::loadUserByUsername;
    }
}
